﻿@using AspDotNet.Framework.Mvc.FirstDemo.Models;
@using Newtonsoft.Json;
@model Student
@{
    ViewBag.Title = "ShowHtml";
    Html.EnableClientValidation();
    Html.EnableUnobtrusiveJavaScript();
}

<h2>ShowHtml</h2>

@using (Html.BeginForm())
{
    <div style="border:solid 1px black;">
        将某个视图或数据加载到此页
        <div>@@Html.Action: @Html.Action("SelectStudent", "Student", new { id = 2 })</div>
    </div>
    <br />
    <div>
        <div>@@Html.Action: @Html.ActionLink("回到主页", "Index")</div>
    </div>
    <br />

    <div>
        <div>@@Html.AntiForgeryToken: @Html.AntiForgeryToken()</div>
    </div>
    <br />

    <div>
        <div>@@Html.AttributeEncode: @Html.AttributeEncode("asdf<html>")</div>
    </div>
    <br />

    @*@using (@Html.BeginRouteForm())
        {

        }*@

    <div>
        <div>@@Html.CheckBox: @Html.CheckBox(Model.Name, true, new { background_color = "red", @checked = "", font_size = "50" })</div>
        <div>@@Html.CheckBoxFor: @Html.CheckBoxFor(model => model.IsChecked, new { @checked = false })</div>
    </div>
    <br />
    <div>
        <div>@@Html.Display: @Html.Display(nameof(Model.SelfIntroduction))</div>
        <div>@@Html.Display: @Html.Display(nameof(Model.Name))</div>
        <div>@@Html.DisplayFor: @Html.DisplayFor(m => m.SelfIntroduction)</div>
        <div>@@Html.DisplayFor: @Html.DisplayFor(m => m.Name)</div>

        <div>@@Html.DisplayName: @Html.DisplayName(nameof(Model.Name))</div>
        <div>@@Html.DisplayNameFor: @Html.DisplayNameFor(m => m.Name)</div>
        <div>@@Html.DisplayText: @Html.DisplayText(nameof(Model.Name))</div>
        <div>@@Html.DisplayTextFor: @Html.DisplayTextFor(m => m.Name)</div>
    </div>
    <br />
    <div style="border:solid 1px black;">
        <div>@@Html.DisplayForModel: @Html.DisplayForModel()</div>
    </div>
    <br />


    <div>
        <div>@@Html.DropDownList: @Html.DropDownList(nameof(Model.FavouriteMusic), new SelectList(Enum.GetValues(typeof(GoodMusic))), "请选择音乐", new { @class = "form-control" })</div>
        <div>@@Html.DropDownListFor: @Html.DropDownListFor(m => m.FavouriteMusic, new SelectList(Enum.GetValues(typeof(GoodMusic))), "请选择音乐")</div>
    </div>
    <br />

    <div>
        <div>@@Html.Editor: @Html.Editor(nameof(Model.Name))</div>
        <div>@@Html.EditorFor: @Html.EditorFor(m => m.Name)</div>
    </div>
    <br />

    <div style="border:solid 1px black;">
        <div>@@Html.EditorForModel: @Html.EditorForModel()</div>
    </div>
    <br />

    <div>
        EnumDropDownListFor方法需要返回枚举值的委托参数:
        <div>
            @@Html.EnumDropDownListFor:
            @Html.EnumDropDownListFor(mode => mode.FavouriteMusic);
            @Html.ValidationMessageFor(p => p.FavouriteMusic)
        </div>
    </div>
    <br />



    /* https://learn.microsoft.com/en-us/dotnet/standard/base-types/formatting-types */
    <p>@Html.FormatValue("Jone", "Good Morning {0}!!!");</p>

    <br />
    <div>
        <div>@@Html.Hidden: @Html.Hidden(nameof(Model.SelfIntroduction))</div>
        <div>@@Html.HiddenFor: @Html.HiddenFor(m => m.FavouriteMusic)</div>
    </div>
    <br />

    var html5DateRenderingMode = @Html.Html5DateRenderingMode;


    <div>
        <div>@@Html.HttpMethodOverride: @Html.HttpMethodOverride(HttpVerbs.Patch)</div>
        <div>@@Html.HttpMethodOverride: @Html.HttpMethodOverride(HttpVerbs.Delete)</div>
        <div>@@Html.HttpMethodOverride: @Html.HttpMethodOverride(HttpVerbs.Put)</div>
        <div>@@Html.HttpMethodOverride: @Html.HttpMethodOverride(HttpVerbs.Head)</div>
        <div>@@Html.HttpMethodOverride: @Html.HttpMethodOverride(HttpVerbs.Options)</div>
    </div>
    <br />

//    Html.EndForm();

    <p>@Html.FormatValue("Jone", "Good Morning {0}!!!");</p>

    <div>123</div>

    <div>
        @* [MVC - Javascript - Get model by id in Javascript · GitHub](https://gist.github.com/ChrisMoney/19472ea779656f9093c5) *@
        @* 取字段生成了html后http://localhost:55259/Html的ID *@
        <div>@@Html.Id: @Html.Id(nameof(Model.Name))</div>
        <div>@@Html.IdFor: @Html.IdFor(m => m.Name)</div>
        <div>@@Html.IdForModel: @Html.IdForModel()</div>
        <script type="text/javascript" src="~/Scripts/jquery-3.4.1.js"></script>
        <script>
            console.log($("#@Html.IdFor(model => model.Name)").val());
        </script>
    </div>
    <br />
    <div>
        <div>@@Html.Label: @Html.Label(nameof(Model.Name))</div>
        <div>@@Html.Label: @Html.Label(nameof(Model.Name), "Name:")</div>
        <div>@@Html.Label: @Html.Label(nameof(Model.Birthday))</div>
        <div>@@Html.LabelFor: @Html.LabelFor(m => m.Name)</div>
        <div>@@Html.LabelFor: @Html.LabelFor(m => m.Birthday, "出生日期:")</div>
    </div>
    <br />
    <div>
        <div>@@Html.LabelForModel: @Html.LabelForModel()</div>
    </div>
    <br />
    <div>
        <div>@@Html.ListBox: @Html.ListBox(nameof(Model.Role), Model.Role.Select(p => new SelectListItem() { Text = p, Value = p, Selected = false }), new { @class = "form-control" })</div>
    </div>
    <br />
    <div>
        <div>@@Html.Password: @Html.Password(nameof(Model.SelfIntroduction))</div>
        <div>@@Html.Password: @Html.PasswordFor(m => m.SelfIntroduction, new { @class = "form-control" })</div>
    </div>
    <br />
    <div>
        <div>@@Html.RadioButton: @Html.RadioButton("group1", "男")</div>
        <div>@@Html.RadioButton: @Html.RadioButton("group1", "女")</div>

        <div>@@Html.RadioButton: @Html.RadioButtonFor(m => m.Name, "男")</div>
        <div>@@Html.RadioButton: @Html.RadioButtonFor(m => m.Name, "女")</div>
    </div>
    <br />
    <div>
        <div>@@Html.TextArea: @Html.TextArea(nameof(Model.SelfIntroduction))</div>
        <div>@@Html.TextAreaFor: @Html.TextAreaFor(m => m.SelfIntroduction, new { @class = "form-control" })</div>
    </div>
    <br />
    <div>
        <div>@@HtmlHtlper.TextBox: @Html.TextBox(nameof(Model.Name))</div>
        <div>@@HtmlHtlper.TextBoxFor: @Html.TextBoxFor(m => m.Name)</div>
        <div>@@HtmlHtlper.TextBoxFor: @Html.TextBoxFor(m => m.Name, new { @class = "form-control" })</div>
    </div>

    <div>
        EnumDropDownListFor方法需要返回枚举值的委托参数:
        <div>
            @@Html.ValidationMessageFor:
            @Html.TextBoxFor(mode => mode.Name);
            @Html.ValidationMessageFor(p => p.Name)
        </div>
    </div>
    <br />
    <input type="submit" name="name" value="提交" />
}